package org.apereo.cas.pm;

import java.io.Serializable;

import org.apereo.cas.CipherExecutor;
import org.apereo.cas.configuration.CasConfigurationProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.hoshiibuy.sys.api.UserApi;


@Configuration("HoshiibuyPasswordManagementConfiguration")
@EnableConfigurationProperties(CasConfigurationProperties.class)
public class HoshiibuyPasswordManagementConfiguration {

    @Autowired
    private CasConfigurationProperties casProperties;

    @Autowired
    @Qualifier("passwordManagementCipherExecutor")
    private CipherExecutor<Serializable, String> passwordManagementCipherExecutor;

    @Autowired
    private UserApi userApi;

    @Bean(name="passwordChangeService")
    public BasePasswordManagementService passwordChangeService(){
        return new HoshiibuyPasswordManagementService(passwordManagementCipherExecutor,casProperties.getServer().getPrefix(),
                casProperties.getAuthn().getPm(),userApi);
    }
}
